
package com.springlearn.zhoufei.other.spring.demo5;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class JDCB1 {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("./other/JDBC.xml");
        StudentDAO dao = (StudentJDBCTemplate) context.getBean("studentJDBCTemplate");
        
        // System.out.println("数据插入");
        // dao.insert("xiao1", 11);
        // dao.insert("xiao2", 12);
        // dao.insert("xiao3", 13);
        
//        System.out.println("获取列表");
//        List<Student> students = dao.list();
//        for (Student record : students) {
//            System.out.println("id : " + record.getId());
//            System.out.println("nam : " + record.getName());
//            System.out.println("age : " + record.getAge());
//            System.out.println("-----");
//        }
        
//        System.out.println("更新数据");
//        dao.update(22, 30);
//
//        System.out.println("获取一个数据");
//        Student student = dao.getById(22);
//        System.out.println("id : " + student.getId());
//        System.out.println("nam : " + student.getName());
//        System.out.println("age : " + student.getAge());
        System.out.println("存储过程");
        Student student1 = dao.procedure01(23);
        System.out.println("id : " + student1.getId());
        System.out.println("nam : " + student1.getName());
        System.out.println("age : " + student1.getAge());
        
    }
}